# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
# Contributor: Anatol Pomozov
# Contributor: Frederic Bezies <fredbezies at gmail dot com>

pkgname=dtc-overlay
pkgver=1.4.1
pkgrel=1
pkgdesc='Device Tree Compiler with device tree overlay support'
url='http://www.devicetree.org/Device_Tree_Compiler'
conflicts=('dtc')
arch=(i686 x86_64)
license=(GPL2)
source=(https://www.kernel.org/pub/software/utils/dtc/dtc-$pkgver.tar.xz
        0001-dtc-Symbol-and-local-fixup-generation-support.patch
        0002-dtc-Plugin-object-device-tree-support.patch
        0003-dtc-Document-the-dynamic-plugin-internals.patch)
sha256sums=('77992ad8eac7b68f553d0ba58e5b51604ac803d126196c99e3ae38aaae28bb94'
            '6efdc127acdc2f5ff4942c1f8e10e3fef30e6d6774a4d2dd6796d78e083bd74b'
            '9e67c8d5b7a7a7da7783167897aab38c0641732f9e0aa3dc6672fd7b13858c13'
            'bee82cf8ae70a9d3036e8b95a529f0d73c5209e1d2e209001bf888cd24df5f8b')

prepare() {
  cd dtc-$pkgver
  patch -p1 -i ../0001-dtc-Symbol-and-local-fixup-generation-support.patch
  patch -p1 -i ../0002-dtc-Plugin-object-device-tree-support.patch
  patch -p1 -i ../0003-dtc-Document-the-dynamic-plugin-internals.patch
}

build() {
  cd dtc-$pkgver
  make
}

check() {
  cd dtc-$pkgver
  make check
}

package() {
  cd dtc-$pkgver
  make DESTDIR="$pkgdir" PREFIX=/usr install
}
